package week05.day02;

import java.util.Arrays;

/**
 *
 */

public class 冒泡排序 {
    public static void main(String[] args) {
        int[] arr = {12,23,53,83,43,46,32,51,23,21,39,31};
        //先生成比较的躺数=数长度-1 3
        for (int i=1;i<=arr.length-1;i++){
            //进行每轮的比较
            for (int j=0;j<=arr.length-i-1;j++){
                if (arr[j]>arr[j+1]){
                    int num = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = num;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
